<template>
	<view class="xy-coupon flex">
		<view class="coupon-money">
			<view class="layof" :style="{color:theme}">￥{{item.couponValue}}</view>
			<view class="demand">订单满{{item.limitMoney}}减{{item.couponValue}}</view>
			<view class="end-time">{{item.expireTime|formatTime}}前使用</view>
		</view>
		<view class="action flex">
			<view @click="click(item.id)" class="btn" v-if="types" :style="{color:color, borderColor:color, background:solid}">{{button}}</view>
			<view @click="click(item.id)" class="btn" v-if="!types" :style="{color:color, borderColor:color, background:solid}">{{button}}</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			item: {
				type: Object
			},
			types: {
				type: String,
				default: ''
			},
			theme: {
				type: String,
				default: '#ff9000'
			},
			solid: {
				type: String,
				default: '#ffffff'
			},
			color: {
				type: String,
				default: '#ff9000'
			},
			button: {
				type: String,
				default: '领取'
			}
		},
		data() {
			return {}
		},
		methods: {
			click(id) {
				this.$emit('action', id);
			}
		}
	}
</script>

<style lang='scss' scoped>
	.xy-coupon {
		width: 100%;
		height: auto;
		border-radius: 5px;
		padding: 0 10px;
		margin-top: 12px;
		border: 1px solid #eeeeee;
		position: relative;
		justify-content: space-around;
		.coupon-money {
			width: 232px;
			height: auto;
			padding: 13px 0;
			border-style: none dotted none none;
			border-color: #eeeeee;
			.nick {
				width: 100%;
				height: 25px;
				line-height: 25px;
				font-size: $font-sm;
				color: $font-color-999;
			}
			.tit {
				width: 100%;
				height: 50upx;
				line-height: 50upx;
				font-size: $font-sm;
				color: $font-color-999;
			}
			.demand {
				width: 100%;
				height: 30upx;
				line-height: 30upx;
				font-size: $font-sm;
				color: $font-color-999;
			}
			.layof {
				width: 100%;
				height: 48upx;
				line-height: 30upx;
				font-size: 44upx;
				color: #ff9000;
				font-weight: bold;
			}
			.end-time {
				width: 100%;
				height: 30upx;
				line-height: 30upx;
				font-size: $font-sm;
				color: $font-color-999;
			}
		}
		.action {
			flex: 1;
			align-items: center;
			justify-content: flex-end;
			padding-left: 10px;
			.btn {
				width: 50px;
				height: 22px;
				line-height: 22px;
				text-align: center;
				border-radius: 20px;
				color: #ff9000;
				border: 1px solid #ff9000;
				font-size: $font-sm;
				float: right;
			}
		}
	}
	.xy-coupon:after {
		width: 20px;
		height: 10px;
		position: absolute;
		left: 230px;
		top: -1px;
		border-radius: 0 0 20px 20px;
		content: "";
		display: block;
		background: $bgcolor_white;
		border: 1px solid #eeeeee;
		border-top: 0px;
	}
	.xy-coupon:before {
		width: 20px;
		height: 10px;
		position: absolute;
		left: 230px;
		bottom: -1px;
		border-radius: 20px 20px 0 0;
		content: "";
		display: block;
		background: $bgcolor_white;
		border: 1px solid #eeeeee;
		border-bottom: 0px;
	}
</style>
